//
//  ZqlBaseTableVC.swift
//  ZqlSinaWeiBo
//
//  Created by 赵乾龙 on 16/2/16.
//  Copyright © 2016年 Mr.zhao. All rights reserved.
//

import UIKit

class ZqlBaseTableVC: UITableViewController ,ZqlVisitorLoginViewDelegate{
    
    //用户是否登录标示
    var userLogin = ZqlAccountVM.shardAccountVM.userLogin
    
    //设置访客视图属性
    var visitorLoginView:ZqlVisitorLoginView?
    
    override func loadView() {
        if userLogin{
            super.loadView()
        }else{
            
            //显示自定义的访客视图
            visitorLoginView = ZqlVisitorLoginView()
            
            //指定代理
            visitorLoginView?.zqlVLDelegate = self
            
            view=visitorLoginView
            
            //设置导航条按钮
            navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登录", style: .Plain, target: self, action: "userWillLogin")
            navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: .Plain, target: self, action: "userWillRegister")
        }
    }
    
    func userWillLogin() {
        //实例化控制器
        let oauth=ZqlOAuthVC()
        //将oauth设为导航控制器的根控制器
        let nav=UINavigationController(rootViewController: oauth)
        //moda出导航控制器
        presentViewController(nav, animated: true, completion: nil)
    }
    
    func userWillRegister() {
        //print(__FUNCTION__)
    }

    
    override func viewDidLoad() {
        super.viewDidLoad()

        // Uncomment the following line to preserve selection between presentations
        // self.clearsSelectionOnViewWillAppear = false

        // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
        // self.navigationItem.rightBarButtonItem = self.editButtonItem()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

    // MARK: - Table view data source
//
//    override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
//        // #warning Incomplete implementation, return the number of sections
//        return 0
//    }
//
//    override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
//        // #warning Incomplete implementation, return the number of rows
//        return 0
//    }
//
//   
}
